package br.com.plurianual.util;

import java.util.ResourceBundle;

import javax.faces.context.FacesContext;

public final class TextUtil {

	public static final String RESOURCE_MESSAGE = "br.com.plurianual.resources.internationalization.message";
	public static final String RESOURCE_TEXT = "br.com.plurianual.resources.internationalization.text";


	/**
	 * Retorna o objeto ResourceBundle referente a mensagens do sistema.
	 * 
	 * @return the message
	 */
	public static ResourceBundle getMessage() {
		return ResourceBundle.getBundle(RESOURCE_MESSAGE, FacesContext
				.getCurrentInstance().getViewRoot().getLocale());
	}
	/**
	  * Retorna string referente a chave informada .
	 * 
	 * @return the message
	 */
	public static String getMessage(String key) {
		return ResourceBundle.getBundle(
				RESOURCE_MESSAGE,
				FacesContext.getCurrentInstance().getViewRoot().getLocale())
				.getString(key);
	}

	/**
	 * Retorna o objeto ResourceBundle referente a textos de componentes e
	 * telas.
	 * 
	 * @return the text
	 */
	public static String getText(String key) {
		return ResourceBundle.getBundle(RESOURCE_TEXT,
				FacesContext.getCurrentInstance().getViewRoot().getLocale())
				.getString(key);
	}

	/**
	 * Retorna string referente a chave informada .
	 * 
	 * @return the text
	 */
	public static ResourceBundle getText() {
		return ResourceBundle.getBundle(RESOURCE_TEXT, FacesContext
				.getCurrentInstance().getViewRoot().getLocale());
	}
}
